﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ZdSoft.Web.OnlineStudy.App_Start.Filter
{

    public class LoggingFilterAttribute : ActionFilterAttribute 
    {       
        public override void OnActionExecuting(ActionExecutingContext
           filterContext)
        {
            filterContext.HttpContext.Trace.Write("Starting: " +
            filterContext.ActionDescriptor.ActionName);
        }

        public override void OnActionExecuted(ActionExecutedContext
            filterContext)
        {
            if (filterContext.Exception != null)
            {
                filterContext.HttpContext.Trace.Write("Exception thrown");
            }
        }
    }
}